<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ include file="../../include/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>批量导入虚拟数据</title>
<script type="text/javascript" src="<c:url value='/scripts/boot.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/ajaxfileupload.js'/>"></script>
</head>
<body>
	<div style="margin-top: 20px;">
		 <form id="form1" method="post" enctype="multipart/form-data">
		 <a class="mini-button" iconCls="icon-edit" href="<c:url value='/templates/importVirtualData.xlsx'/>">模版下载</a>
		 	&nbsp;&nbsp;&nbsp;
			<input id="updatefile" class="mini-htmlfile" name="updatefile" limitType="*.xlsx;*.xls" required/>
		 	&nbsp;&nbsp;<a class="mini-button"  onClick="upload()">导入</a>
		 </form>
	 </div>
	 
	<script type="text/javascript">
		function upload(){
			var form = new mini.Form("form1");
			form.validate();
		    if (form.isValid() == false) return;
			var msgid = mini.loading("数据处理中，请稍后......", "处理数据");
			$.ajaxFileUpload({
				url:"/virtualData/importVirtual.action",
				secureuri:false,
				fileElementId:'updatefile',
				dataType: 'json',
				success: function (data, status){
					mini.showTips({
                        content: "<b>成功</b> <br/>成功导入"+data+"条记录",
                        state: "success",
                        x: "center",
                        y: "center",
                        timeout: 3000
                    });
					mini.hideMessageBox(msgid);
				},
				error: function (jqXHR, textStatus, errorThrown){
					mini.hideMessageBox(msgid);
					mini.showMessageBox({
                        showModal: false,
                        width: 250,
                        title: "提示",
                        iconCls: "mini-messagebox-warning",
                        message: jqXHR.responseText,
                        timeout: 3000,
                        x: "right",
                        y: "bottom"
                    });
				}
			});
			
		}
		//关闭窗口
		function CloseWindow(action) {
	        if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
	        else window.close();
	    }
	</script>
	
</body>
</html>